var wrapper = Array.from(document.querySelectorAll('.wrapper')).slice(1)

var cities = {}

wrapper.forEach(function (city, index) {
  var letter = city.children[0].innerText
  var arr = []
  // 给arr中添加数据
  var allCity = Array.from(city.children[1].children)

  // 进行第二次循环
  allCity.forEach(function (c, index) {
    arr.push({
      name: c.innerText.trim(),
      code: +c.getAttribute('code')
    })
  })

  cities[letter] = arr
})


var hc = document.querySelector('.hc')
var hcities = Array.from(hc.children[1].children)
var hot = []
hcities.forEach(function (c) {
  hot.push({
    name: c.innerText.trim(),
    code: +c.getAttribute('code')
  })
})




var area = {
  hot: hot,
  cities: cities
}

console.log(JSON.stringify(area))